<template>
  <BasicModal :title="$t('table.system.system_root_quota')" @register="registerQuota">
    <Tabs v-model:activeKey="activeKey">
                <TabPane v-for="item in currencyTreeList" :tab="item.name" :key="item.id">
                  <Form>
                    <Row>
                      <Col :span="18">
                        <FormItem
                          :label="$t('table.system.system_root_addMony') + '：'"
                          :labelCol="{ span: 7 }"
                        >
                          <InputNumber
                            v-model:value="item.apiMap.addMoney"
                            :disabled="item.apiMap.addMoneyLimit"
                            :placeholder="$t('table.system.system_root_noLimit')"
                          />
                        </FormItem>
                      </Col>
                      <Col :span="4">
                        <Checkbox
                          class="!mt-2 !ml-4"
                          :checked="item.apiMap.addMoneyLimit"
                          v-model:value="item.apiMap.addMoneyLimit"
                          @change="(e) => (item.apiMap.addMoneyLimit = e.target.checked)"
                        >{{ $t('table.discountActivity.discount_no_limit') }}</Checkbox>
                      </Col>
                    </Row>
                    <Row>
                      <Col :span="18">
                        <FormItem
                          :label="$t('table.system.system_root_single') + '：'"
                          :labelCol="{ span: 7 }"
                          ><InputNumber
                            v-model:value="item.apiMap.singleTrans"
                            :disabled="item.apiMap.singleTransLimit"
                            :placeholder="$t('table.system.system_root_noLimit')"
                          />
                        </FormItem>
                      </Col>
                      <Col :span="4">
                        <Checkbox
                          class="!mt-2 !ml-4"
                          :checked="item.apiMap.singleTransLimit"
                          v-model:value="item.apiMap.singleTransLimit"
                          @change="(e) => (item.apiMap.singleTransLimit = e.target.checked)"
                        >{{ $t('table.discountActivity.discount_no_limit') }}</Checkbox>
                      </Col>
                    </Row> </Form
                >
                </TabPane>
              </Tabs>
  </BasicModal>
</template>

<script lang="ts" setup>
  import { ref } from 'vue';
  import { BasicModal, useModalInner } from '/@/components/Modal';
  import { Form, FormItem, InputNumber, Row, Col, Checkbox,Tabs,
    TabPane } from 'ant-design-vue';
  import { useFormSetting } from '/@/hooks/setting/useFormSetting';
  import { useCurrencyStore } from '/@/store/modules/currency';
  const { getCurrencyList } = useCurrencyStore();
  const  currencyTreeList  = ref(<any>[])
    getCurrencyList.forEach((item) => {
      const tab = {
      id: item.id,
      name: item.name,
      apiMap: {
        addMoney:0,
        addMoneyLimit:true,
        singleTrans:0,
        singleTransLimit:true,
      }}
      currencyTreeList.value.push(tab)
    })
  const addMoney = ref(0);
  const FORM_SIZE = useFormSetting().getFormSize;
  const [registerQuota] = useModalInner(() => {
    console.log('XXX');
  });
</script>
